<?php
namespace app\manager\controller;
/**
 * 菜单模块
 */
class Menu extends Base
{
	
	public function index(){
		$list = $this->model->all();
		return $this->fetch('', ['list' => $list]);		
	}
	
	public function create(){
	    return $this->fetch();
	}
	
	public function save(){
		$jquery = ['method' => 'saveMenu', 'success' => '/menu', 'error' => null];
		$this->store($this->request->post(), $jquery, function($data){});
	}
	
	public function edit($id){
		$data = $this->model->find($id);
	    return $this->fetch('', ['data' => $data]);

	}
	
	public function update(){
		$jquery = ['method' => 'updateMenu', 'success' => '/menu', 'error' => null];
		$this->store(array_merge($this->request->param(), ['status' => 0]), $jquery, function($data){});
	}
}

?>